<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>EX-admin 整合 NKeditor 编辑器</title>
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
    </head>
    <body>

        <div class="x-body">

            <blockquote class="layui-elem-quote">
                本页面所有 demo 均采用的 NKeditor 编辑器，想了解更多有关 NKeditor 信息，请点击
                <a href="https://gitee.com/blackfox/kindeditor" target="_blank" class="text-color-red text-bold">这里</a> 查看。
            </blockquote>

            <div class="layui-col-sm12" style="margin-bottom: 15px;">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>Default Skin</legend>
                </fieldset>

                <textarea name="content1" style="width:900px;height:200px;visibility:hidden;">春花秋月何时了，往事知多少，小楼昨夜又东风，故国不堪回首月明中。</textarea>
            </div>

            <div class="layui-col-sm12" style="margin-bottom: 15px;">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>Skin Black</legend>
                </fieldset>

                <textarea name="content2" style="width:900px;height:200px;visibility:hidden;">春花秋月何时了，往事知多少，小楼昨夜又东风，故国不堪回首月明中。</textarea>
            </div>


            <div class="layui-col-sm12" style="margin-bottom: 15px;">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>Skin Grey</legend>
                </fieldset>

                <textarea name="content3" style="width:900px;height:200px;visibility:hidden;">春花秋月何时了，往事知多少，小楼昨夜又东风，故国不堪回首月明中。</textarea>
            </div>


            <div class="layui-col-sm12" style="margin-bottom: 15px;">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>Skin Blue</legend>
                </fieldset>

                <textarea name="content4" style="width:900px;height:200px;visibility:hidden;">春花秋月何时了，往事知多少，小楼昨夜又东风，故国不堪回首月明中。</textarea>
            </div>

        </div>

        <script type="text/javascript" src="./lib/jquery.min.js "></script>
        <script charset="utf-8" src="./lib/NKeditor/NKeditor-all-min.js"></script>
        <script type="text/javascript" src="./lib/layui/layui.js"></script>
        <script>
	        layui.use(['layer'], function(){

		        KindEditor.ready(function(K) {
			        K.create('textarea[name="content1"]', {
				        uploadJson : "http://herosphp.r9it.com/admin/upload/qiniu",
				        fileManagerJson : 'http://herosphp.r9it.com/admin/upload/filelist',
				        imageSearchJson : null, //图片搜索url
				        dialogOffset : 0, //对话框距离页面顶部的位置，默认为0居中，
				        filePostName: 'file',
				        allowFileManager : true,
				        allowImageUpload : true,
				        allowMediaUpload : true,
				        afterCreate : function() {
					        var self = this;
					        K.ctrl(document, 13, function() {
						        self.sync();
						        K('form[name=example]')[0].submit();
					        });
					        K.ctrl(self.edit.doc, 13, function() {
						        self.sync();
						        K('form[name=example]')[0].submit();
					        });
				        },
				        //错误处理 handler
				        errorMsgHandler : function(message, type) {
					        layer.alert(message);
				        }
			        });

			        K.create('textarea[name="content2"]', {
				        uploadJson : "http://herosphp.r9it.com/admin/upload/qiniu",
				        fileManagerJson : 'http://herosphp.r9it.com/admin/upload/filelist',
				        imageSearchJson : null, //图片搜索url
				        dialogOffset : 0, //对话框距离页面顶部的位置，默认为0居中，
				        filePostName: 'file',
				        allowFileManager : true,
				        allowImageUpload : true,
				        allowMediaUpload : true,
				        themeType : "black", //主题
				        //错误处理 handler
				        errorMsgHandler : function(message, type) {
					        layer.alert(message);
				        }
			        });

			        K.create('textarea[name="content3"]', {
				        uploadJson : "http://herosphp.r9it.com/admin/upload/qiniu",
				        fileManagerJson : 'http://herosphp.r9it.com/admin/upload/filelist',
				        imageSearchJson : null, //图片搜索url
				        dialogOffset : 0, //对话框距离页面顶部的位置，默认为0居中，
				        filePostName: 'file',
				        allowFileManager : true,
				        allowImageUpload : true,
				        allowMediaUpload : true,
				        themeType : "grey", //主题
				        //错误处理 handler
				        errorMsgHandler : function(message, type) {
					        layer.alert(message);
				        }
			        });

			        K.create('textarea[name="content4"]', {

				        uploadJson : "http://herosphp.r9it.com/admin/upload/qiniu",
				        fileManagerJson : 'http://herosphp.r9it.com/admin/upload/filelist',
				        imageSearchJson : null, //图片搜索url
				        dialogOffset : 0, //对话框距离页面顶部的位置，默认为0居中，
				        filePostName: 'file',
				        allowFileManager : true,
				        allowImageUpload : true,
				        allowMediaUpload : true,
				        themeType : "blue", //主题
				        //错误处理 handler
				        errorMsgHandler : function(message, type) {
					        layer.alert(message);
				        }
			        });
		        });

	        });

        </script>
    </body>
</html>